package com.gl.codewar.template;

public class RedundantAcronymSyndrome {

	public static String format(String str) {
		
		String result = "";
		
		String [] array = str.split("\\n");
		
		
		for (int i = 0; i < array.length; i++) {
			String line = array[i];
			if (line.equalsIgnoreCase("END")) {
				continue;
			}
			String [] lineArray = line.split(" ");
			String acro = "";
			for (int j = 0; j < lineArray.length; j++) {
				String word = lineArray[j];
				String first = String.valueOf(word.charAt(0));
				
				acro += first.toUpperCase();
			}
			
			String last = lineArray[lineArray.length - 1];
			
			result += acro + " " + last + "\n";
		}
		
		// TODO Auto-generated method stub
		return result;
	}

}
